
Partial Class Default2
    Inherits System.Web.UI.Page

    Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click

        Dim user As MembershipUser = Membership.GetUser
        Dim p As ProfileCommon = ProfileCommon.Create(user.UserName)
        Dim ContractLogic As New GTSSystem.BLL.Contract()
        Try
            ContractLogic.AddContract(p.ClientId, p.BranchId, ddlCarrier.SelectedValue, StartDate.SelectedDate, EndDate.SelectedDate)
            Response.Redirect(Request.Url.ToString, False)
            Message.Text = "Contract added successfully"
            RemoveControls()
        Catch ex As Exception
            Message.Text = "Unable to add contract"
        End Try
    End Sub
    Private Sub RemoveControls()
        btnAdd.Visible = False
        StartDate.Visible = False
        EndDate.Visible = False
        ddlCarrier.Visible = False
        lblStartDate.Visible = False
        lblEndDate.Visible = False
        lblCarrier.Visible = False
    End Sub


End Class
